<template>
  <div class="banner">
    <div class="img-wrapper"
         @click="handleGalleryShow">
      <img class="img-item"
           :src="bannerImg"
           alt="">
      <div class="img-info">
        <div class="name">{{sightName}}</div>
        <div class="detail">
          <span class="iconfont count-icon">&#xe624;</span>{{gallaryImgs.length}}
        </div>
      </div>
    </div>
    <gallery :imgs="gallaryImgs"
             @closeGalley="handleGalleryClose"
             v-show="showGallery"></gallery>
    <!-- <opacity-animation>
      <gallery :imgs="gallaryImgs"
               @closeGalley="handleGalleryClose"
               v-show="showGallery"></gallery>
    </opacity-animation> -->
  </div>
</template>
<script>
import Gallery from 'common/gallery/Gallery'
import OpacityAnimation from 'common/animation/Animation'
export default {
  props: {
    sightName: String,
    gallaryImgs: Array,
    bannerImg: String
  },
  data () {
    return {
      showGallery: false
    }
  },
  methods: {
    handleGalleryShow () {
      this.showGallery = true
    },
    handleGalleryClose () {
      this.showGallery = false
    }
  },
  components: { Gallery, OpacityAnimation }
}
</script>
<style lang="stylus" scoped>
.banner
  .img-wrapper
    position: relative
    height: 0
    padding-bottom: 50%
    overflow: hidden
    .img-item
      width: 100%
    .img-info
      position: absolute
      bottom: 0
      left: 0
      width: 100%
      line-height: 0.44rem
      padding: 0.15rem
      box-sizing: border-box
      // 渐变色
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      color: #fff
      .name
        float: left
      .detail
        float: right
</style>
